TData
The type of the data to create the dataset from.
LEADTOOLS Medical (Leadtools.Dicom.Scu assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
Create<TData>(DicomScp,TData) Method
See Also 
Leadtools.Dicom.Scu Namespace > PerformedProcedureStepScu Class > Create Method : Create<TData>(DicomScp,TData) Method




Scp
The peer connection to send the N-CREATE-REQ to.
Data
The data to send in the request.
Scp
The peer connection to send the N-CREATE-REQ to.
Data
The data to send in the request.
Sends an N-CREATE-REQ to the SCP.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub Create(Of TData)( _
   ByVal Scp As DicomScp, _
   ByVal Data As TData _
) 
Visual Basic (Usage)Copy Code
Dim instance As PerformedProcedureStepScu
Dim Scp As DicomScp
Dim Data As TData
 
instance.Create(Of TData)(Scp, Data)
C# 
public void Create<TData>( 
   DicomScp Scp,
   TData Data
)
Managed Extensions for C++ 
public: void Create<TData>( 
   DicomScp* Scp,
   TData* Data
) 
C++/CLI 
public:
void Creategeneric<typename TData>
( 
   DicomScp^ Scp,
   TData^ Data
) 

Parameters

Scp
The peer connection to send the N-CREATE-REQ to.
Data
The data to send in the request.

Type Parameters

TData
The type of the data to create the dataset from.

Example

Create a Modality Performed Procedure Step and sets it to complete.

Visual BasicCopy Code
Private WorkLists As New List(Of ModalityWorklistResult)()


Public Sub PerformMPPS()
   DicomEngine.Startup()
   DicomNet.Startup()

   Dim query As New ModalityWorklistQuery()
   Dim scp As New DicomScp()
   Dim findMwl As New QueryRetrieveScu()

   scp.AETitle = "MWL_SERVER"
   scp.Port = 104
   scp.Timeout = 60
   scp.PeerAddress = IPAddress.Parse("192.168.0.209")
   findMwl.AETitle = "LEAD_CLIENT"
   findMwl.Find(Of ModalityWorklistQuery, ModalityWorklistResult)(scp, query, AddressOf FoundWorklist)

   '
   ' Create a Modality Perform Procedure Step
   If WorkLists.Count > 0 Then
      Dim mpps As ModalityPerformedProcedureStep = ModalityPerformedProcedureStep.From(WorkLists(0))
      Dim pps As New PerformedProcedureStepScu()

      pps.AETitle = "LEAD_CLIENT"
      AddHandler pps.BeforeNCreate, AddressOf pps_BeforeNCreate
      AddHandler pps.AfterNCreate, AddressOf pps_AfterNCreate
      AddHandler pps.BeforeNSet, AddressOf pps_BeforeNSet
      AddHandler pps.AfterNSet, AddressOf pps_AfterNSet

      '
      ' Initialize required procedure step variables
      '
      mpps.PerformedStationAeTitle = Environment.MachineName
      mpps.PerformedProcedureStepStartDate = DateTime.Now
      mpps.PerformedProcedureStepStartTime = DateTime.Now
      mpps.PerformedSeriesSequence(0).ProtocolName = ModalityPerformedProcedureStep.RandomId(16)
      mpps.PerformedSeriesSequence(0).SeriesInstanceUID = "1.2.3.4.5.890.1232"
      mpps.SOPInstance.SOPInstanceUid = "1.2.3.4.5.890.1240.1"

      Try
         pps.Create(Of ModalityPerformedProcedureStep)(scp, mpps)

         '
         ' Set the procedure step to done
         '
         mpps.PerformedProcedureStepEndDate = DateTime.Now
         mpps.PerformedProcedureStepEndTime = DateTime.Now
         mpps.PerformedProcedureStepStatus = "COMPLETED"
         pps.[Set](Of ModalityPerformedProcedureStep)(scp, mpps)
      Catch e As Exception
         Console.WriteLine(e.Message)
      End Try
   End If

   DicomEngine.Shutdown()
   DicomNet.Startup()
End Sub

Private Sub FoundWorklist(ByVal result As ModalityWorklistResult, ByVal ds As DicomDataSet)
   WorkLists.Add(result)
End Sub

Private Sub pps_BeforeNCreate(ByVal sender As Object, ByVal e As CommonEventArgs)
   Console.WriteLine("Before N-CREATE-REQ")
   Console.WriteLine(vbTab & "Affected Class: " & e.AffectedClass)
   Console.WriteLine(vbTab & "Instance: " & e.Instance)
   Console.WriteLine(vbTab & "MessageId: " & e.MessageID.ToString())
   Console.WriteLine(vbTab & "PresentationId: " & e.PresentationID.ToString())
End Sub

Private Sub pps_AfterNCreate(ByVal sender As Object, ByVal e As StatusCommonEventArgs)
   Console.WriteLine("After N-CREATE-REQ")
   Console.WriteLine(vbTab & "Affected Class: " & e.AffectedClass)
   Console.WriteLine(vbTab & "Instance: " & e.Instance)
   Console.WriteLine(vbTab & "MessageId: " & e.MessageID.ToString())
   Console.WriteLine(vbTab & "PresentationId: " & e.PresentationID.ToString())
   Console.WriteLine(vbTab & "Status: " & e.Status.ToString())
End Sub

Private Sub pps_BeforeNSet(ByVal sender As Object, ByVal e As CommonEventArgs)
   Console.WriteLine("Before N-SET-REQ")
   Console.WriteLine(vbTab & "Affected Class: " & e.AffectedClass)
   Console.WriteLine(vbTab & "Instance: " & e.Instance)
   Console.WriteLine(vbTab & "MessageId: " & e.MessageID.ToString())
   Console.WriteLine(vbTab & "PresentationId: " & e.PresentationID.ToString())
End Sub

Private Sub pps_AfterNSet(ByVal sender As Object, ByVal e As StatusCommonEventArgs)
   Console.WriteLine("After N-CREATE-REQ")
   Console.WriteLine(vbTab & "Affected Class: " & e.AffectedClass)
   Console.WriteLine(vbTab & "Instance: " & e.Instance)
   Console.WriteLine(vbTab & "MessageId: " & e.MessageID.ToString())
   Console.WriteLine(vbTab & "PresentationId: " & e.PresentationID.ToString())
   Console.WriteLine(vbTab & "Status: " & e.Status.ToString())
End Sub
C#Copy Code
List<ModalityWorklistResult> WorkLists = new List<ModalityWorklistResult>();


public void PerformMPPS()
{
    DicomEngine.Startup();
    DicomNet.Startup();

    ModalityWorklistQuery query = new ModalityWorklistQuery();
    DicomScp scp = new DicomScp();
    QueryRetrieveScu findMwl = new QueryRetrieveScu();

    scp.AETitle = "MWL_SERVER";
    scp.Port = 104;
    scp.Timeout = 60;
    scp.PeerAddress = IPAddress.Parse("192.168.0.209");
    findMwl.AETitle = "LEAD_CLIENT";
    findMwl.Find<ModalityWorklistQuery, ModalityWorklistResult>(scp, query, FoundWorklist);

    //
    // Create a Modality Perform Procedure Step
    if (WorkLists.Count > 0)
    {
        ModalityPerformedProcedureStep mpps = ModalityPerformedProcedureStep.From(WorkLists[0]);
        PerformedProcedureStepScu pps = new PerformedProcedureStepScu();

        pps.AETitle = "LEAD_CLIENT";
        pps.BeforeNCreate += new EventHandler<Leadtools.Dicom.Scu.Common.CommonEventArgs>(pps_BeforeNCreate);
        pps.AfterNCreate += new EventHandler<StatusCommonEventArgs>(pps_AfterNCreate);
        pps.BeforeNSet += new EventHandler<CommonEventArgs>(pps_BeforeNSet);
        pps.AfterNSet += new EventHandler<StatusCommonEventArgs>(pps_AfterNSet);

        //
        // Initialize required procedure step variables
        //
        mpps.PerformedStationAeTitle = Environment.MachineName;
        mpps.PerformedProcedureStepStartDate = DateTime.Now;
        mpps.PerformedProcedureStepStartTime = DateTime.Now;
        mpps.PerformedSeriesSequence[0].ProtocolName = ModalityPerformedProcedureStep.RandomId(16);
        mpps.PerformedSeriesSequence[0].SeriesInstanceUID = "1.2.3.4.5.890.1232";
        mpps.SOPInstance.SOPInstanceUid = "1.2.3.4.5.890.1240.1";

        try
        {
            pps.Create<ModalityPerformedProcedureStep>(scp, mpps);

            //
            // Set the procedure step to done
            //
            mpps.PerformedProcedureStepEndDate = DateTime.Now;
            mpps.PerformedProcedureStepEndTime = DateTime.Now;
            mpps.PerformedProcedureStepStatus = "COMPLETED";
            pps.Set<ModalityPerformedProcedureStep>(scp, mpps);                    
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
    }

    DicomEngine.Shutdown();
    DicomNet.Startup();
}        

private void FoundWorklist(ModalityWorklistResult result, DicomDataSet ds)
{
    WorkLists.Add(result);
}

void pps_BeforeNCreate(object sender, CommonEventArgs e)
{
    Console.WriteLine("Before N-CREATE-REQ");
    Console.WriteLine("\tAffected Class: " + e.AffectedClass);
    Console.WriteLine("\tInstance: " + e.Instance);
    Console.WriteLine("\tMessageId: " + e.MessageID.ToString());
    Console.WriteLine("\tPresentationId: " + e.PresentationID.ToString());
}

void pps_AfterNCreate(object sender, StatusCommonEventArgs e)
{
    Console.WriteLine("After N-CREATE-REQ");
    Console.WriteLine("\tAffected Class: " + e.AffectedClass);
    Console.WriteLine("\tInstance: " + e.Instance);
    Console.WriteLine("\tMessageId: " + e.MessageID.ToString());
    Console.WriteLine("\tPresentationId: " + e.PresentationID.ToString());
    Console.WriteLine("\tStatus: " + e.Status.ToString());
}        

void pps_BeforeNSet(object sender, CommonEventArgs e)
{
    Console.WriteLine("Before N-SET-REQ");
    Console.WriteLine("\tAffected Class: " + e.AffectedClass);
    Console.WriteLine("\tInstance: " + e.Instance);
    Console.WriteLine("\tMessageId: " + e.MessageID.ToString());
    Console.WriteLine("\tPresentationId: " + e.PresentationID.ToString());
}

void pps_AfterNSet(object sender, StatusCommonEventArgs e)
{
    Console.WriteLine("After N-CREATE-REQ");
    Console.WriteLine("\tAffected Class: " + e.AffectedClass);
    Console.WriteLine("\tInstance: " + e.Instance);
    Console.WriteLine("\tMessageId: " + e.MessageID.ToString());
    Console.WriteLine("\tPresentationId: " + e.PresentationID.ToString());
    Console.WriteLine("\tStatus: " + e.Status.ToString());
}

Remarks

A DicomDataset will be created from the Data parameter. This dataset will then be sent in the N-CREATE-REQ. The Data class should be decorated with the correct attributes for creating the dataset.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.Dicom.Scu requires a Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features